﻿namespace ExamV5.ManagSys
{
    using ExamV5;
    using System;
    using System.IO;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;

    public class FrmChooseICO : Page
    {
        protected HtmlForm form1;
        private PublicFun publicFun_0 = new PublicFun();
        protected string strAllICO = "<table width='95%' align='center' border='0' cellpadding='0' cellspacing='0'>";
        protected string strHeadTitle;

        private void Page_Load(object sender, EventArgs e)
        {
            try
            {
                base.Response.Cache.SetCacheability(HttpCacheability.NoCache);
                base.Response.Cache.SetNoStore();
                int num = 1;
                DirectoryInfo info = new DirectoryInfo(base.Server.MapPath("../Image/MenuICO"));
                FileInfo[] files = info.GetFiles("*.jpg ");
                FileInfo[] infoArray2 = info.GetFiles("*.gif ");
                foreach (FileInfo info3 in files)
                {
                    if (num == 1)
                    {
                        this.strAllICO = this.strAllICO + "<tr height='30'><td><a href='#' onclick=javascript:SaveImg('" + info3.Name + "');><img src='../image/menuico/" + info3.Name + "' border=0></a></td>";
                    }
                    else
                    {
                        this.strAllICO = this.strAllICO + "<td><a href='#' onclick=javascript:SaveImg('" + info3.Name + "');><img src='../image/menuico/" + info3.Name + "' border=0></a></td>";
                    }
                    num++;
                    if (num > 10)
                    {
                        num = 1;
                        this.strAllICO = this.strAllICO + "</tr>";
                    }
                }
                foreach (FileInfo info2 in infoArray2)
                {
                    if (num != 1)
                    {
                        this.strAllICO = this.strAllICO + "<td><a href='#' onclick=javascript:SaveImg('" + info2.Name + "');><img src='../image/menuico/" + info2.Name + "' border=0></a></td>";
                    }
                    else
                    {
                        this.strAllICO = this.strAllICO + "<tr height='30'><td><a href='#' onclick=javascript:SaveImg('" + info2.Name + "');><img src='../image/menuico/" + info2.Name + "' border=0></a></td>";
                    }
                    num++;
                    if (num > 10)
                    {
                        num = 1;
                        this.strAllICO = this.strAllICO + "</tr>";
                    }
                }
                if (num < 10)
                {
                    for (int i = num; i < 11; i++)
                    {
                        this.strAllICO = this.strAllICO + "<td></td>";
                    }
                    this.strAllICO = this.strAllICO + "</tr>";
                }
                this.strAllICO = this.strAllICO + "</table>";
            }
            catch
            {
                base.Response.Write("<script>alert('请将系统image/MenuICO目录权限设置为Everyone用户可读取修改权限！')</script>");
            }
        }
    }
}

